/// @tags: Expectation Matrix
#include <cstdio>
#include <iostream>

using namespace std;

namespace BlueQuantum {

typedef long long LL;

int constexpr P = 998244353;

int n, k, inv, ans;

inline void inc(int& a, int b) {
  a += b;
  if (a >= P) a -= P;
}

inline LL qpow(LL base, int index = P - 2) {
  LL res = 1;
  while (index) {
    if (index & 1) res = res * base % P;
    base = base * base % P;
    index >>= 1;
  }
  return res;
}

struct Matrix {
  int a11, a12, a13, a22, a23;
  Matrix(int a, int b, int c, int d, int e) : a11(a), a12(b), a13(c), a22(d), a23(e) {}
  inline Matrix operator*(Matrix const& rhs) const {
    return Matrix((LL)a11 * rhs.a11 % P, ((LL)a11 * rhs.a12 + (LL)a12 * rhs.a22) % P,
                  ((LL)a11 * rhs.a13 + (LL)a12 * rhs.a23 + a13) % P,
                  (LL)a22 * rhs.a22 % P, ((LL)a22 * rhs.a23 + a23) % P);
  }
};

inline int qpow(Matrix base) {
  Matrix res(1, 0, 0, 1, 0);
  for (int exp = k; exp; exp >>= 1) {
    if (exp & 1) res = res * base;
    base = base * base;
  }
  return res.a13;
}

void solve(int L, int R, int l, int r) {
  if (L < R) {
    int m;
    cin >> m;
    solve(L, m, L, R);
    solve(m + 1, R, L, R);
  }
  if (l == 0)
    inc(ans, inv);
  else {
    int a = ((LL)l * (l - 1) + (LL)(n - r) * (n - r + 1)) / 2 % P,
        b = ((LL)L * (r - R) + (LL)(n - R + 1) * (L - l)) % P,
        c = (LL)l * (n - r + 1) % P,
        d = ((LL)(l + L - 1) * (L - l) + (LL)(n * 2 - R - r + 1) * (r - R)) / 2 % P;
    inc(ans, qpow(Matrix((LL)(a + c) * inv % P, (LL)d * inv % P, (LL)b * inv % P,
                         (LL)(a + d) * inv % P, (LL)(b + c) * inv % P)));
  }
}

inline int main() {
  cin >> n >> k;
  inv = qpow((LL)n * (n + 1) / 2 % P);
  solve(1, n, 0, 0);
  cout << ans;
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("P6630 [ZJOI2020] 传统艺能.in", "r", stdin);
  freopen("P6630 [ZJOI2020] 传统艺能.out", "w", stdout);
#endif
#endif

  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
